# -*- coding: utf-8 -*-

from scrapy.selector import Selector
from scrapy.contrib.spiders import CrawlSpider,Rule
from scrapy.contrib.linkextractors import LinkExtractor

from hzw.items import HzwItem


class HzwSpider(CrawlSpider):
    name = "hzw_crawl"
    allowed_domains = ["hzw.com.cn"]
    start_urls = ["http://www.hzw.com.cn/"]
    rules = [
        Rule(LinkExtractor(allow=('item.htm\?id=\d+')), callback='parse_item'),
    ]

    def parse_item(self, response):
        print(response.url)
        item = HzwItem()
        # item['title'] = response.xpath('//div[@class="pro-name"]')
        # item['link'] = '---link---'
        # item['img'] = '---img---'
        
        return item
